/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
/**
 *
 * @author user
 */
public class TestFrame_1 extends JFrame {

    private JRadioButton but = null;
    private JTextField field = null;

    public TestFrame_1 () {
        setSize(800, 600);
        but = new JRadioButton ("setEditable");
        but.setSelected(true);
        field = new JTextField ("Test Text");
        field.setEditable(true);

        Container contentPane = getContentPane();
        contentPane.setLayout(new BorderLayout(1,1));
        contentPane.add(but, BorderLayout.NORTH);
        contentPane.add(field, BorderLayout.SOUTH);

        but.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e){
                if(but.isSelected()) {
                    field.setEditable(true);
                }
                else {
                    field.setEditable(false);
                }
            }
        });

    }

             public static void main(String[] args)
  {


      //Создание фрейма в потоке обработки событий
      SwingUtilities.invokeLater
              (
              new Runnable()
                 {
                 public void run()
                   {

                    new TestFrame_1();


                   }
                 }
              );
  }
}